//
//  CreatMIddleView.m
//  OurMenu
//
//  Created by 尹坤 on 15/10/12.
//  Copyright © 2015年 尹坤. All rights reserved.
//

#import "CreatMIddleView.h"
#import "MiddleController.h"
@implementation CreatMIddleView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatMyView];
    }
    return self;
}
- (void)creatMyView
{
    //breakfirst
    
    self.breakfirstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.breakfirstButton.frame = CGRectMake(5, 15, self.frame.size.width/4 - 10, self.frame.size.width/4 - 10);
    self.breakfirstButton.backgroundColor = [UIColor redColor];
    self.breakfirstButton.layer.cornerRadius = self.breakfirstButton.frame.size.width / 2;
//    self.breakfirstButton.layer.borderWidth = 5;
//    self.breakfirstButton.layer.borderColor = [UIColor blueColor].CGColor;
    self.breakfirstButton.layer.masksToBounds = YES;
    [self addSubview:self.breakfirstButton];
    //lunch
    
    self.lunchButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.lunchButton.frame = CGRectMake(self.breakfirstButton.frame.origin.x + self.breakfirstButton.frame.size.width + 10, 15, self.breakfirstButton.frame.size.width, self.breakfirstButton.frame.size.height);
    self.lunchButton.backgroundColor = [UIColor redColor];
    self.lunchButton.layer.cornerRadius = self.lunchButton.frame.size.width / 2;
//    self.lunchButton.layer.borderWidth = 5;
//    self.lunchButton.layer.borderColor = [UIColor blueColor].CGColor;
    self.lunchButton.layer.masksToBounds = YES;
    [self addSubview:self.lunchButton];
    //dinner
    
    self.dinnerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.dinnerButton.frame = CGRectMake(self.lunchButton.frame.origin.x + self.lunchButton.frame.size.width + 10, 15, self.lunchButton.frame.size.width, self.lunchButton.frame.size.height);
    self.dinnerButton.backgroundColor = [UIColor redColor];
    self.dinnerButton.layer.cornerRadius = self.lunchButton.frame.size.width / 2;
//    self.dinnerButton.layer.borderWidth = 5;
//    self.dinnerButton.layer.borderColor = [UIColor blueColor].CGColor;
    self.dinnerButton.layer.masksToBounds = YES;
    [self addSubview:self.dinnerButton];
    //dessert
    
    self.dessertButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.dessertButton.frame = CGRectMake(self.dinnerButton.frame.origin.x + self.dinnerButton.frame.size.width + 10, 15, self.dinnerButton.frame.size.width, self.dinnerButton.frame.size.height);
    self.dessertButton.backgroundColor = [UIColor redColor];
    self.dessertButton.layer.cornerRadius = self.lunchButton.frame.size.width / 2;
//    self.dessertButton.layer.borderWidth = 5;
//    self.dessertButton.layer.borderColor = [UIColor blueColor].CGColor;
    self.dessertButton.layer.masksToBounds = YES;
    [self addSubview:self.dessertButton];
    //label
    
    self.breakfirstLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.breakfirstButton.frame.origin.x, self.breakfirstButton.frame.origin.y + self.breakfirstButton.frame.size.height + 10, self.breakfirstButton.frame.size.width, 40)];
    self.breakfirstLabel.text = @"早餐";
    self.breakfirstLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.breakfirstLabel];
    
    self.lunchLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.lunchButton.frame.origin.x, self.breakfirstLabel.frame.origin.y, self.lunchButton.frame.size.width, 40)];
    self.lunchLabel.text = @"午餐";
    self.lunchLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.lunchLabel];
    
    self.dinnerLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.dinnerButton.frame.origin.x, self.lunchLabel.frame.origin.y, self.dinnerButton.frame.size.width, 40)];
    self.dinnerLabel.text = @"晚餐";
    self.dinnerLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.dinnerLabel];
    
    self.dessertLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.dessertButton.frame.origin.x, self.dinnerLabel.frame.origin.y, self.dessertButton.frame.size.width, 40)];
    self.dessertLabel.text = @"甜点";
    self.dessertLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.dessertLabel];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
